{%extends "tardis_portal/data_browsing_template.html" %}
{% load experimentstats %}

{% block script %}

{% include "tardis_portal/javascript_libraries.html" %} 

<script type="text/javascript">
$(document).ready(function(){
  var users = (function () {
  var val = null;
  var authMethod = "localdb";
  var data = { authMethod: authMethod };
  $.ajax({
    'async': false,
    'global': false,
    'data': data,
    'url': '/ajax/parameter_field_list',
    'success': function (data) {
       val = data;
     }
   });
 return val;
  })();
});
</script>
{% endblock script %}

{% block content %}
<div id = "content">
  <div class="post">
    <div class = "entry">  
        <h1 class="title">Search Results for <em>{{ query|default:"' '"}}</em></h1>
      {% if experiments%}
      <strong>{{experiments.items|length}}</strong> Experiment{{experiments.items|length|pluralize}}
      {% endif %}
      {% for key, result in experiments.items %}
      {% ifequal result.sr.model_name 'experiment' %}
        {% include "search/experiment_result.html" %}
      {% else %}
        {% ifequal result.sr.model_name 'dataset' %}
          {% include "search/dataset_result.html" %}
      {% else %}
        {% ifequal result.sr.model_name 'dataset_file' %}
          {% include "search/dataset_file_result.html" %}
        {% endifequal %}{% endifequal %}{% endifequal %}

      {% empty %}
        <p>No Results found</p>
      {% endfor%}

    </div> <!-- entry -->
  </div> <!-- post -->
</div> <!-- content -->
{% endblock content%}
